const {
  get,
  post,
  pureGet,
  upload
} = require("./../utils/http");

const {
  contactUrlParams
} = require("./../utils/util");
// 微信授权登录
const wxLogin = param => {
  const query = contactUrlParams(param)
  return post(`api/auth/loginByWx`, param);
}
//绑定手机号
const wxMobileLogin = param => {
  const query = contactUrlParams(param)
  return post(`api/auth/loginByWxMobile`, param);
}
//获取用户信息
const decodeUserInfo=param=>{
  return get(`api/user`)
}
//获取用户信息
const decodeUserTotal=param=>{
  return get(`api/user/total`)
}
//更新用户信息
const updateUserInfo=param=>{
  const query=contactUrlParams(param)
  return post(`api/user${query}`)
}
const withDraw=param=>{
  return post(`api/withdrawal-apply`,param)
}
const withDrawRecords=param=>{
  return get(`api/withdrawal-apply/page`,param)
}
const ruleList=param=>{
  return get(`api/platform/rule`,param)
}
const sysSetting=param=>{
  return get(`sys/setting`)
}
const spec_and_price=param=>{
  return get(`api/dict/spec_and_price`)
}
const getReward=param=>{
  const orderNo=param.orderNo
  const amount=param.amount
  return get(`/api/pay/run-order/${orderNo}/reward?amount=${amount}`)
}

const sysConfig=param=>{
  return get(`api/dict`)
}

//获取微信支付请求参数

module.exports = {
  wxLogin,
  decodeUserTotal,
  wxMobileLogin,
  updateUserInfo,
  withDraw,
  withDrawRecords,
  decodeUserInfo,
  ruleList,
  sysSetting,
  spec_and_price,
  getReward,
  sysConfig
}
